package com.first.nell.components.step

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
import com.first.nell.R
import com.first.nell.databinding.ViewFirstNellInfoStepBinding

class InfoStep(context: Context, attrs: AttributeSet) :
    RelativeLayout(context, attrs) {

    private var mFirstNellViewFirstNellBinding: ViewFirstNellInfoStepBinding
    private var vFirstNellRootFirstNellView: View

    init {
        vFirstNellRootFirstNellView = LayoutInflater.from(context).inflate(R.layout.view_first_nell_info_step, this)
        mFirstNellViewFirstNellBinding = ViewFirstNellInfoStepBinding.bind(vFirstNellRootFirstNellView)
    }

    fun setFirstNellStartFirstNellNode(): InfoStep {
        mFirstNellViewFirstNellBinding.vAdpterInfoLineLeft.visibility = GONE
        return this
    }

    fun setFirstNellEndFirstNellNode(): InfoStep {
        mFirstNellViewFirstNellBinding.vAdpterInfoLineRight.visibility = GONE
        return this
    }

    fun setFirstNellSelectedFirstNellNode(selected: Boolean): InfoStep {
        if (selected) {
            mFirstNellViewFirstNellBinding.textAdpterInfoDot.setBackgroundResource(R.drawable.first_nell_info_step_dot_selected)
        } else {
            mFirstNellViewFirstNellBinding.textAdpterInfoDot.setBackgroundResource(R.drawable.first_nell_info_step_dot_unselect)
        }
        return this
    }
}